package tt.dz.biz.service.financial;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import tt.dz.biz.dao.financial.CostServiceMerchantDAO;
import tt.dz.common.LogUtil;
import tt.dz.vo.CostServiceMerchantVO;

@Service("costServiceMerchantService")
public class CostServiceMerchantService
{
  @Resource(name="costServiceMerchantDAO")
  private CostServiceMerchantDAO costServiceMerchantDAO;
  
  public List<CostServiceMerchantVO> listAllCostServiceMerchant()
  {
    List<CostServiceMerchantVO> serviceMerchantList = null;
    try
    {
      serviceMerchantList = this.costServiceMerchantDAO.listAllCostServiceMerchant();
    }
    catch (Exception e)
    {
      LogUtil.error("查询所有的代收成本服务对应的虚拟运营商标异常", e);
      serviceMerchantList = new ArrayList();
    }
    return serviceMerchantList;
  }
  
  public boolean insertCostServiceMerchant(CostServiceMerchantVO costServiceMerchantVO)
  {
    boolean excuteFlag = false;
    try
    {
      int i = this.costServiceMerchantDAO.insertCostServiceMerchant(costServiceMerchantVO);
      excuteFlag = i > 0;
    }
    catch (Exception e)
    {
      LogUtil.error("插入代收成本服务对应的虚拟运营商标异常--入参：" + costServiceMerchantVO.toString(), e);
    }
    return excuteFlag;
  }
  
  public boolean updateCostServiceMerchant(CostServiceMerchantVO costServiceMerchantVO)
  {
    boolean excuteFlag = false;
    try
    {
      int i = this.costServiceMerchantDAO.updateCostServiceMerchant(costServiceMerchantVO);
      excuteFlag = i > 0;
    }
    catch (Exception e)
    {
      LogUtil.error("更新代收成本服务对应的虚拟运营商标异常--入参：" + costServiceMerchantVO.toString(), e);
    }
    return excuteFlag;
  }
  
  public List<CostServiceMerchantVO> getCostServiceMerchantByCondition(CostServiceMerchantVO costServiceMerchantVO)
  {
    List<CostServiceMerchantVO> serviceMerchantList = null;
    try
    {
      serviceMerchantList = this.costServiceMerchantDAO.listCostServiceMerchantByCondition(costServiceMerchantVO);
    }
    catch (Exception e)
    {
      LogUtil.error("查询条件下的代收成本服务对应的虚拟运营商标异常", e);
      serviceMerchantList = new ArrayList();
    }
    return serviceMerchantList;
  }
}
